home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Amiga_Mail_Vol2 / Archives / Plain / nd90 / packets / packets.txt
Encoding:
Text File  |  1991-02-05  |  51.2 KB  |  1,344 lines

  1. (c)  Copyright 1991 Commodore-Amiga, Inc.   All rights reserved.
  2. The information contained herein is subject to change without notice,
  3. and is provided "as is" without warranty of any kind, either expressed
  4. or implied.  The entire risk as to the use of this information is
  5. assumed by the user.
  6.  
  7.  
  8.  
  9.  
  10. AmigaDOS Packet Interface Specification
  11.  
  12. by John Toebes
  13.  
  14.  
  15. AmigaDOS communicates with file systems and other DOS handlers by
  16. sending and receiving packets.  Opening and closing file handles
  17. (including console file handles), creating directories, and renaming
  18. disks all require DOS to tell a handler to perform these actions
  19. through sending a packet.  The particular action a handler performs
  20. depends on the type of packet it receives.
  21.  
  22. This article documents the standard AmigaDOS packet types.  For
  23. information on how to use packets to communicate with handlers see the
  24. AmigaDOS Manual.
  25.  
  26. Packets sent to a file system or handler can be divided into several
  27. basic categories:
  28.  
  29.         Basic Input/Output
  30.  
  31. These actions deal with tranferring data to and from objects
  32. controlled by the handler.
  33.  
  34.         File/Directory Manipulation/Information
  35.  
  36. These actions are used to gain access to and manipulate the high level
  37. structures of the file system.
  38.  
  39.         Volume Manipulation/Information
  40.  
  41. These actions allow access to the specific volume controlled by the
  42. file system.
  43.  
  44.         Handler Maintenance and Control
  45.  
  46. These allow control over the handler/file system itself, independent
  47. of the actual volume or structure underneath.
  48.  
  49.         Handler Internal
  50.  
  51. These actions are never sent to the handler directly.  Instead they
  52. are generally responses to IO requests made by the handler.  The
  53. handler makes these responses look like packets in order to simplify
  54. processing.
  55.  
  56.         Obsolete Packets
  57.  
  58. These packets are no longer valid for use by handlers and file
  59. systems.
  60.  
  61.         Console Only Packets
  62.  
  63. These packets are specific to console handlers.  File Systems can
  64. ignore these packets.
  65.  
  66.  
  67.  
  68. Much of this information can be extracted from Developer Conference
  69. notes , The AmigaDOS Manual, and various Fred Fish disks.  However,
  70. because there is no single complete reference to these packet types, a
  71. consolidated view of all the packets is presented here.  Several
  72. structures are referenced here which can be found by looking at the
  73. include files <dos/dos.h> and <dos/dosextens.h>.  (If you are using
  74. the 1.3 version of the include files, these are in the libraries
  75. directory instead of the dos directory).  Before attempting to work
  76. with a file handler you should first become familiar with these files.
  77.  
  78. Each packet type documented in this article is listed with its action
  79. name, its corresponding number, any AmigaDOS routines which uses this
  80. packet, and the list of parameters that the packets uses.  The C
  81. variable types for the packet parameters are one of the following
  82. types:
  83.  
  84.  
  85.  
  86. BPTR    This is BCPL pointer (the address of the given object shifted
  87. right by 2).  Note: this means that the object must be aligned on a
  88. longword boundary.
  89.  
  90.  
  91. LOCK    This is a BPTR to a FileLock structure returned by a previous
  92. ACTION_LOCATE_OBJECT.  A lock of 0 is legal, indicating the root of
  93. the volume for the handler.
  94.  
  95.  
  96. BSTR    This is a BPTR to a string where the first byte indicates the
  97. number of characters in the string.  This length byte is unsigned but
  98. because it is stored in a byte, the strings are limited to 255
  99. characters in length.
  100.  
  101.  
  102. BOOL    A 32-bit boolean value either containing DOSTRUE (-1) or
  103. DOSFALSE (0).  Note: equality comparisons with DOSTRUE should be
  104. avoided.
  105.  
  106.  
  107. CODE    A 32 bit error code as defined in the dos/dos.h include file.
  108. Handlers should not return error codes besides those defined in
  109. dos/dos.h.
  110.  
  111.  
  112. ARG1    The FileHandle->fh_Arg1 field.
  113.  
  114.  
  115. LONG    A 32 bit integer value.
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124. Basic Input/Output
  125.  
  126. The Basic Input/Output actions are supported by both handlers and file
  127. systems.  In this way, the application can get a stream level access
  128. to both devices and files.  One difference that arises between the two
  129. is that a handler will not necessarily support an ACTION_SEEK while it
  130. is generally expected for a file system to do so.
  131.  
  132. These actions work based on a FileHandle which is filled in by one of
  133. the three forms of opens:
  134.  
  135. ACTION_FINDINPUT         1005    Open(..., MODE_OLDFILE)
  136. ACTION_FINDOUTPUT        1006    Open(..., MODE_NEWFILE)
  137. ACTION_FINDUPDATE        1004    Open(..., MODE_READWRITE)
  138. ARG1:    BPTR    FileHandle to fill in 
  139. ARG2:    LOCK    Lock on directory that ARG3 is relative to
  140. ARG3:    BSTR    Name of file to be opened (relative to ARG1)
  141.  
  142. RES1:    BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  143. RES2:    CODE    Failure code if RES1 is DOSFALSE
  144.  
  145. All three actions use the lock (ARG2) as a base directory location
  146. from which to open the file.  If this lock is NULL, then the file name
  147. (ARG3) is relative to the root of the current volume.  Because of
  148. this, file names are not limited to a single file name but instead can
  149. include a volume name (followed by a colon) and multiple slashes
  150. allowing the file system to fully resolve the name.  This eliminates
  151. the need for AmigaDOS or the application to parse names before sending
  152. them to the file system.  Note that the lock in ARG2 must be
  153. associated with the file system in question.  It is illegal to use a
  154. lock from another file system.
  155.  
  156. The calling program owns the file handle (ARG1).  The program must
  157. initialize the file handle before trying to open anything (in the case
  158. of a call to Open(), AmigaDOS allocates the file handle automatically
  159. and then frees it in Close() ).  All fields must be zero except the
  160. fh_Pos and fh_End fields which should be set to -1.  Upon a successful
  161. open, the handler is responsible for filling in the fh_Type field with
  162. a pointer to the MsgPort of the handler process.  Lastly, the handler
  163. must initialize fh_Arg1 with something that allows the handler to
  164. uniquely locate the object being opened (normally a file).  This value
  165. is implementation specific.  This field is passed to the
  166. READ/WRITE/SEEK/ END/TRUNCATE operations and not the file handle
  167. itself.
  168.  
  169. FINDINPUT and FINDUPDATE are similar in that they only succeed if the
  170. file already exists.  FINDINPUT will open with a shared lock while
  171. FINDUPDATE will open it with a shared lock but if the file doesn't
  172. exist, FINDUPDATE will create the file.  FINDOUTPUT will always open
  173. the file (deleting any existing one) with an exclusive lock.
  174.  
  175.  
  176. ACTION_READ              'R'     Read(...)
  177. ARG1:    ARG1    fh_Arg1 field of the opened FileHandle
  178. ARG2:    APTR    Buffer to put data into
  179. ARG3:    LONG    Number of bytes to read
  180.  
  181. RES1:    LONG    Number of bytes read.   
  182.        0 indicates EOF.
  183.       -1 indicates ERROR
  184. RES2:    CODE    Failure code if RES1 is -1
  185.  
  186. This action extracts data from the file (or input channel) at the
  187. current position.  If fewer bytes remain in the file than requested,
  188. only those bytes remaining will be returned with the number of bytes
  189. stored in RES1.  The handler indicates an error is indicated by
  190. placing a -1 in RES1 and the error code in RES2.  If the read fails,
  191. the current file position remains unchanged.  Note that a handler may
  192. return a smaller number of bytes than requested, even if not at the
  193. end of a file.  This happens with interactive type file handles which
  194. may return one line at a time as the user hits return, for example the
  195. console handler, CON:.
  196.  
  197.  
  198. ACTION_WRITE             'W'     Write(...)
  199. ARG1:    ARG1    fh_Arg1 field of the opened file handle
  200. ARG2:    APTR    Buffer to write to the file handle
  201. ARG3:    LONG    Number of bytes to write
  202.  
  203. RES1:    LONG    Number of bytes written.
  204. RES2:    CODE    Failure code if RES1 not the same as ARG3
  205.  
  206. This action copies data into the file (or output channel) at the
  207. current position.  The file is automatically extended if the write
  208. passes the end of the file.  The handler indicates failure by
  209. returning a byte count in RES1 that differs from the number of bytes
  210. requested in ARG3.  In the case of a failure, the handler does not
  211. update the current file position (although the file may have been
  212. extended and some data overwritten) so that an application can safely
  213. retry the operation.
  214.  
  215.  
  216. ACTION_SEEK              1008    Seek(...)
  217. ARG1:    ARG1    fh_Arg1 field of the opened FileHandle
  218. ARG2:    LONG    New Position
  219. ARG3:    LONG    Mode:   OFFSET_BEGINNING,OFFSET_END, or  OFFSET_CURRENT
  220.  
  221. RES1:    LONG    Old Position.   -1 indicates an error
  222. RES2:    CODE    Failure code if RES1 = -1
  223.  
  224. This packet sets the current file position.  The new position (ARG2)
  225. is relative to either the beginning of the file (OFFSET_BEGINNING),
  226. the end of the file (OFFSET_END), or the current file position
  227. (OFFSET_CURRENT), depending on the mode set in ARG3.  Note that ARG2
  228. can be negative.  The handler returns the previous file position in
  229. RES1.  Any attempt to seek past the end of the file will result in an
  230. error and will leave the current file position in an unknown location.
  231.  
  232.  
  233. ACTION_END               1007    Close(...)
  234. ARG1:   ARG1    fh_Arg1 field of the opened FileHandle
  235.  
  236. RES1:   LONG    DOSTRUE
  237.  
  238. This packet closes an open file handle.  This function generally
  239. returns a DOSTRUE as there is little the application can do to recover
  240. from a file closing failure.  If an error is returned under 2.0, DOS
  241. will not deallocate the file handle.  Under 1.3, it does not check the
  242. result.
  243.  
  244.  
  245.  
  246.  
  247.  
  248. ACTION_LOCK_RECORD       2008    LockRecord(fh,pos,len,mod,tim)
  249. ARG1:   BPTR    FileHandle to lock record in 
  250. ARG2:   LONG    Start position (in bytes) of record in the file
  251. ARG3:   LONG    Length (in bytes) of record to be locked
  252. ARG4:   LONG    Mode
  253.                  0 = Exclusive
  254.                  1 = Immediate Exclusive (timeout is ignored)
  255.                  2 = Shared
  256.                  3 = Immediate Shared (timeout is ignored)
  257. ARG5:   LONG    Timeout period in AmigaDOS ticks (0 is legal)
  258.  
  259. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  260. RES2:   CODE    Failure code if RES1 is DOSFALSE
  261.  
  262. This function locks an area of a file in either a sharable (indicating
  263. read-only) or exclusive (indicating read/write) mode.  Several
  264. sharable record locks from different file handles can exist
  265. simultaneously on a particular file area but only one file handle can
  266. have exclusive record locks on a particular area at a time.  The
  267. ``exclusivity'' of an exclusive file lock only applies to record locks
  268. from other file handles, not to record locks within the file handle.
  269. One file handle can have any number of overlapping exclusive record
  270. locks.  In the event of overlapping lock ranges, the entire range must
  271. be lockable before the request can succeed.  The timeout period (ARG5)
  272. is the number of AmigaDOS ticks (1/50 second) to wait for success
  273. before failing the operation.
  274.  
  275.  
  276. ACTION_FREE_RECORD       2009    FreeRecord(file,pos,len)
  277. ARG1:   BPTR    FileHandle to unlock record in 
  278. ARG2:   LONG    Start position (in bytes) of record in the file
  279. ARG3:   LONG    Length of record (in bytes) to be unlocked
  280.  
  281. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  282. RES2:   CODE    Failure code if RES1 is DOSFALSE
  283.  
  284. This function unlocks any previous record lock.  If the given range
  285. does not represent one that is currently locked in the file,
  286. ACTION_FREE_RECORD returns an error.  In the event of multiple locks
  287. on a given area, only one lock is freed.
  288.  
  289.  
  290. ACTION_SET_FILE_SIZE     1022    SetFileSize(file,off,mode)
  291. ARG1:   BPTR    FileHandle of opened file to modify 
  292. ARG2:   LONG    New end of file location based on mode
  293. ARG3:   LONG    Mode.  One of OFFSET_CURRENT, OFFSET_BEGIN, or OFFSET_END
  294.  
  295. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  296. RES2:   CODE    Failure code if RES1 is DOSFALSE
  297.  
  298. This function is used to change the physical size of an opened file.
  299. ARG2, the new end-of-file position, is relative to either the current
  300. file position (OFFSET_CURRENT), the beginning of the file
  301. (OFFSET_BEGIN), or the end of the file (OFFSET_END), depending on the
  302. mode set in ARG3.  The current file position will not change unless
  303. the current file position is past the new end-of-file position.  In
  304. this case, the new file position will move to the new end of the file.
  305. If there are other open file handles on this file,
  306. ACTION_SET_FILE_SIZE sets the end-of-file for these alternate file
  307. handles to either their respective current file position or to the new
  308. end-of-file position of the file handle in ARG1, whichever makes the
  309. file appear longer.
  310.  
  311.  
  312.  
  313.  
  314. Directory/File Manipulation/Information
  315.  
  316. The directory/file actions permits an application to make queries
  317. about and modifications to handler objects. These packets perform
  318. functions such as creating subdirectories, resolving links, and
  319. filling in FileInfoBlock structures for specific files.
  320.  
  321.  
  322. ACTION_LOCATE_OBJECT     8       Lock(...)
  323. ARG1:   LOCK    Lock on directory to which ARG2 is relative
  324. ARG2:   BSTR    Name (possibly with a path) of object to lock
  325. ARG3:   LONG    Mode:   ACCESS_READ/SHARED_LOCK, ACCESS_WRITE/EXCLUSIVE_LOCK
  326.  
  327. RES1:   LOCK    Lock on requested object or 0 to indicate failure
  328. RES2:   CODE    Failure code if RES1 = 0
  329.  
  330. The AmigaDOS function Lock() uses this action to create its locks.
  331. Given a name for the object, which may include a path, (ARG2) and a
  332. lock on a directory from which to look for the name (and path),
  333. ACTION_LOCATE_OBJECT will locate the object within the file system and
  334. create a FileLock structure associated with the object.  If the
  335. directory lock in ARG1 is NULL, the name is relative to the root of
  336. the file handler's volume (a.k.a. ``:'').  The memory for the FileLock
  337. structure returned in RES1 is maintained by the handler and freed by
  338. an ACTION_FREE_LOCK.  Although it's not a requirement, if an handler
  339. expects to support the pre-1.3 Format command, it must accept any
  340. illegal mode as ACCESS_READ.
  341.  
  342. A handler can create an exclusive lock only if there are no other
  343. outstanding locks on the given object. Once created, an exclusive lock
  344. prevents any other locks from being created for that object.  In
  345. general, a handler uses the FileLock->fl_Key field to uniquely
  346. identify an object.  Note that some applications rely on this
  347. (although a handler is not required to implement this packet).
  348.  
  349. The fl_Volume field of the returned FileLock structure should point to
  350. the DOS device list's volume entry for the volume on which the lock
  351. exists.  In addition, there are several diagnostic programs that
  352. expect all locks for a volume to be chained together off the
  353. dl_LockList field in the volume entry.  Note that relying on this
  354. chaining is not safe, and can cause serious problems including a
  355. system crash.  No application should use it.
  356.  
  357.  
  358. ACTION_COPY_DIR          19      DupLock(...)
  359. ARG1:   LOCK    Lock to duplicate
  360.  
  361. RES1:   LOCK    Duplicated Lock or 0 to indicate failure
  362. RES2:   CODE    Failure code if RES1 = 0
  363.  
  364. This action's name is misleading as it does not manipulate
  365. directories.  Instead, it creates a copy of a shared lock.  The copy
  366. is subsequently freed with an ACTION_FREE_LOCK.  Note that it is valid
  367. to pass a NULL lock.  Currently, the DupLock() call always returns 0
  368. if passed a 0, although a handler is not required to return a 0.
  369.  
  370.  
  371. ACTION_FREE_LOCK         15      UnLock(...)
  372. ARG1:   LOCK    Lock to free
  373.  
  374. RES1:   BOOL    TRUE
  375.  
  376. This action frees the lock passed to it.  The AmigaDOS function
  377. Unlock() uses this packet.  If passed a NULL lock, the handler should
  378. return success.  ACTION_EXAMINE_OBJECT 23 Examine(...)  ARG1: LOCK
  379. Lock of object to examine ARG2: BPTR FileInfoBlock to fill in
  380.  
  381. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  382. RES2:   CODE    Failure code if RES1 = DOSFALSE
  383.  
  384. This action fills in the FileInfoBlock with information about the
  385. locked object.  The Examine() function uses this packet.  This packet
  386. is actually used for two different types of operations.  It is called
  387. to obtain information about a given object while in other cases, it is
  388. called to prepare for a sequence of EXAMINE_NEXT operations in order
  389. to traverse a directory.
  390.  
  391. This seemingly simple operation is not without its quirks.  One in
  392. particular is the FileInfoBlock->fib_Comment field.  This field used
  393. to be 116 bytes long, but was changed to 80 bytes in release 1.2.  The
  394. extra 36 bytes lie in the fib_Reserved field.  Another quirk of this
  395. packet is that both the fib_EntryType and the fib_DirEntryType fields
  396. must be set to the same value, as some programs look at one field
  397. while other programs look at the other.
  398.  
  399. File systems should use the same values for fib_DirEntryType as the
  400. ROM file system and ram-handler do.  These are as follows:
  401.  
  402. ST_ROOT          1
  403. ST_USERDIR       2
  404. ST_SOFTLINK      3 NOTE: this Shows up as a directory unless checked
  405.                    for explicitly 
  406. ST_LINKDIR       4
  407. ST_FILE         -3
  408. ST_LINKFILE     -4
  409.  
  410. Also note that for directories, handlers must use numbers greater than
  411. 0, since some programs test to see if fib_DirEntryType is greater than
  412. zero, ignoring the case where fib_DirEntryType equals 0.  Handlers
  413. should avoid using 0 because it is not interpreted consistently.
  414.  
  415.  
  416. ACTION_EXAMINE_NEXT      24      ExNext(...)
  417. ARG1:   LOCK    Lock on directory being examined
  418. ARG2:   BPTR    BPTR FileInfoBlock 
  419.  
  420. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  421. RES2:   CODE    Failure code if RES1 = DOSFALSE
  422.  
  423. The ExNext() function uses this packet to obtain information on all
  424. the objects in a directory.  ACTION_EXAMINE fills in a FileInfoBlock
  425. structure describing the first file or directory stored in the
  426. directory referred to in the lock in ARG1.  ACTION_EXAMINE_NEXT is
  427. used to find out about the rest of the files and directories stored in
  428. the ARG1 directory.  ARG2 contains a pointer to a valid FileInfoBlock
  429. field that was filled in by either an ACTION_EXAMINE or a previous
  430. ACTION_EXAMINE_NEXT call.  It uses this structure to find the next
  431. entry in the directory.  This packets writes over the old
  432. FileInfoBlock with information on the next file or directory in the
  433. ARG2 directory.  ACTION_EXAMINE_NEXT returns a failure code of
  434. ERROR_NO_MORE_ENTRIES when there are no more files or directories left
  435. to be examined.  Unfortunately, like ACTION_EXAMINE, this packet has
  436. its own peculiarities.  Among the quirks that ACTION_EXAMINE_NEXT must
  437. account for are:
  438.  
  439.  The situation where an application calls ACTION_EXAMINE_NEXT one or
  440. more times and then stops invoking it before encountering the end of
  441. the directory.  
  442.  
  443.  The situation where a FileInfoBlock passed to ACTION_EXAMINE_NEXT is
  444. not the same as the one passed to ACTION_EXAMINE or even the previous
  445. EXAMINE_NEXT operation.  Instead, it is a copy of the FileInfoBlock
  446. with only the fib_DiskKey and the first 30 bytes of the fib_FileName
  447. fields copied over.  This is now considered to be illegal and will not
  448. work in the future.  Any new code should not be written in this
  449. manner.
  450.  
  451.  Because a handler can receive other packet types between
  452. ACTION_EXAMINE_NEXT operations, the ACTION_EXAMINE_NEXT function must
  453. handle any special cases that may result.
  454.  
  455.  The LOCK passed to ACTION_EXAMINE_NEXT is not always the same lock
  456. used in previous operations.  It is however a lock on the same object.
  457.  
  458. Because of these problems, ACTION_EXAMINE_NEXT is probably the
  459. trickiest action to write in any handler.  Failure to handle any of
  460. the above cases can be quite disastrous.
  461.  
  462.  
  463. ACTION_CREATE_DIR        22      CreateDir(...)
  464. ARG1:   LOCK    Lock to which ARG2 is relative
  465. ARG2:   BSTR    Name of new directory  (relative to ARG1)
  466.  
  467. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  468. RES2:   CODE    Failure code if RES1 = DOSFALSE
  469.  
  470. ACTION_DELETE_OBJECT     16      DeleteFile(...)
  471. ARG1:   LOCK    Lock to which ARG2 is relative
  472. ARG2:   BSTR    Name of object to delete (relative to ARG1)
  473.  
  474. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  475. RES2:   CODE    Failure code if RES1 = DOSFALSE
  476.  
  477. ACTION_RENAME_OBJECT     17      Rename(...)
  478. ARG1:   LOCK    Lock to which ARG2 is relative
  479. ARG2:   BSTR    Name of object to rename (relative to ARG1)
  480. ARG3:   LOCK    Lock associated with target directory
  481. ARG4:   BSTR    Requested new name for the object
  482.  
  483. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  484. RES2:   CODE    Failure code if RES1 = DOSFALSE
  485.  
  486. These three actions perform most of the work behind the AmigaDOS
  487. commands MakeDir, Delete, and Rename (for single files).  These
  488. packets take as their parameters a lock describing where the file is
  489. and a name relative to that lock.  It is the responsibility of the
  490. file system to ensure that the operation is not going to cause adverse
  491. effects.  In particular, the RENAME_OBJECT action allows moving files
  492. across directory bounds and as such must ensure that it doesn't create
  493. hidden directory loops by renaming a directory into a child of itself.
  494.  
  495. For Directory objects, the DELETE_OBJECT action must ensure that the
  496. directory is empty before allowing the operation.
  497.  
  498.  
  499. ACTION_PARENT            29      Parent(...)
  500. ARG1:   LOCK    Lock on object to get the parent of
  501.  
  502. RES1:   LOCK    Parent Lock
  503. RES2:   CODE    Failure code if RES1 = 0
  504.  
  505. This action receives a lock on an object and creates a shared lock on
  506. the object's parent.  If the original object has no parent, then a
  507. lock of 0 is returned.  Note that this operation is typically used in
  508. the process of constructing the absolute path name of a given object.
  509.  
  510. ACTION_SET_PROTECT       21      SetProtection(...)
  511. ARG1:   Unused
  512. ARG2:   LOCK    Lock to which ARG3 is relative
  513. ARG3:   BSTR    Name of object (relative to ARG2)
  514. ARG4:   LONG    Mask of new protection bits
  515.  
  516. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  517. RES2:   CODE    Failure code if RES1 = DOSFALSE
  518.  
  519. This action allows an application to modify the protection bits of an
  520. object.  The 4 lowest order bits (RWED) are a bit peculiar.  If their
  521. respective bit is set, that operation is not allowed (i.e. if a file's
  522. delete bit is set the file is not deleteable).  By default, files are
  523. created with the RWED bits set and all others cleared.  Additionally,
  524. any action which modifies a file is required to clear the A (archive)
  525. bit.  See the dos/dos.h include file for the definitions of the bit
  526. fields.
  527.  
  528.  
  529. ACTION_SET_COMMENT       28      SetComment(...)
  530. ARG1:   Unused
  531. ARG2:   LOCK    Lock to which ARG3 is relative
  532. ARG3:   BSTR    Name  of object (relative to ARG2)
  533. ARG4:   BSTR    New Comment string
  534.  
  535. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  536. RES2:   CODE    Failure code if RES1 = DOSFALSE
  537.  
  538. This action allows an application to set the comment string of an
  539. object.  If the object does not exist then DOSFALSE will be returned
  540. in RES1 with the failure code in RES2.  The comment string is limited
  541. to 79 characters.
  542.  
  543.  
  544. ACTION_SET_DATE          34      SetFileDate(...) in 2.0
  545. ARG1:   Unused
  546. ARG2:   LOCK    Lock to which ARG3 is relative
  547. ARG3:   BSTR    Name  of object (relative to ARG2)
  548. ARG4:   CPTR    DateStamp
  549.  
  550.  
  551. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  552. RES2:   CODE    Failure code if RES1 = DOSFALSE
  553.  
  554. This action allows an application to set an object's creation
  555. date.
  556.  
  557. ACTION_FH_FROM_LOCK      1026    OpenFromLock(lock)
  558. ARG1:   BPTR    Lock of file to be opened
  559. ARG2:   LONG    Mode for file handle - either, MODE_OLDFILE,
  560.                  MODE_NEWFILE, or MODE_READWRITE 
  561.  
  562. RES1:   BPTR    Created filehandle or NULL
  563. RES2:   CODE    Failure code if RES1 = NULL
  564.  
  565. This action open a file from a given lock.  If this action is
  566. successful, the file system will essentially steal the lock so a
  567. program should not use it anymore.  If ACTION_FH_FROM_LOCK fails, the
  568. lock is still usable by an application.
  569.  
  570.  
  571. ACTION_SAME_LOCK         40      SameLock(lock1,lock2)
  572. ARG1:   BPTR    Lock 1 to compare
  573. ARG2:   BPTR    Lock 2 to compare
  574.  
  575. RES1:   LONG    Result of comparison, one of 
  576.     LOCK_SAME          (0) if locks are for the same object      
  577.     LOCK_SAME_HANDLER  (1) if locks are on different objects of
  578.                                 same handler 
  579.     LOCK_DIFFERENT    (-1) otherwise
  580. RES2:   CODE    Failure code if RES1 is LOCK_DIFFERENT
  581.  
  582. This action compares the targets of two locks.  If they point to the
  583. same object, ACTION_SAME_LOCK should return LOCK_SAME. 
  584.  
  585. ACTION_MAKE_LINK         1021    MakeLink(name,targ,mode)
  586. ARG1:   BPTR    Lock on directory ARG2 is relative to
  587. ARG2:   BSTR    Name of the link to be created (relative to ARG1)
  588. ARG3:   BPTR    Lock on target object or name (for soft links).
  589. ARG4:   LONG    Mode of link, either LINK_SOFT or LINK_HARD
  590.  
  591. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  592. RES2:   CODE    Failure code if RES1 is DOSFALSE
  593.  
  594. This packet causes the file system to create a link to an already
  595. existing file or directory.  There are two kinds of links, hard links
  596. and soft links.  The basic difference between them is that a file
  597. system resolves a hard link itself, while the file system passes a
  598. string back to DOS telling it where to find a soft linked file or
  599. directory.  To the packet level programmer, there is essentially no
  600. difference between referencing a file by its original name or by its
  601. hard link name.  In the case of a hard link, ARG3 is a lock on the
  602. file or directory that the link is ``linked'' to, while in a soft
  603. link, ARG3 is a BSTR naming the link.
  604.  
  605. In an over-simplified model of the ROM file system, when asked to
  606. locate a file, the system scans a disk looking for a file header with
  607. a specific (file) name.  That file header points to the actual file
  608. data somewhere on the disk.  With hard links, more than one file
  609. header can point to the same file data, so data can be referenced by
  610. more than one name.  When the user tries to delete a hard link to a
  611. file, the system first checks to see if there are any other hard links
  612. to the file.  If there are, only the hard link is deleted, the actual
  613. file data the hard link used to reference remains, so the existing
  614. hard links can still use it.  In the case where the original link (not
  615. a hard or soft link) to a file is deleted, the file system will make
  616. one of its hard links the new ``real'' link to the file.  Hard links
  617. can exist on directories as well.  Because hard links ``link''
  618. directly to the underlying media, hard links in one file system cannot
  619. reference objects in another file system.
  620.  
  621. Soft links are resolved through DOS calls.  When the file system scans
  622. a disk for a file or directory name and finds that the name is a soft
  623. link, it returns an error code (ERROR_IS_SOFT_LINK).  If this happens,
  624. the application must ask the file system to tell it what the link the
  625. link refers to by calling ACTION_READ_LINK.  Soft Links are stored on
  626. the media, but instead of pointing directly to data on the disk, a
  627. soft link contains a path to its object.  This path can be relative to
  628. the lock in ARG1, relative to the volume (where the string will be
  629. prepended by a colon ':'), or an absolute path.  An absolute path
  630. contains the name of another volume, so a soft link can reference
  631. files and directories on other disks.
  632.  
  633.  
  634. ACTION_READ_LINK         1024  ReadLink(port,lck,nam,buf,len)
  635. ARG1:   BPTR    Lock on directory that ARG2 is relative to
  636. ARG2:   CPTR    Path and name of link (relative to ARG1).  NOTE: This
  637.                   is a C string not a BSTR  
  638. ARG3:   APTR    Buffer for new path string
  639. ARG4:   LONG    Size of buffer in bytes
  640.  
  641. RES1:   LONG    Actual length of returned string, -2 if there isn't
  642.                   enough space in buffer,or -1 for other errors  
  643. RES2:   CODE    Failure code
  644.  
  645. This action reads a link and returns a path name to the link's object.
  646. The link's name (plus any necessary path) is passed as a CPTR (ARG2)
  647. which points to a C-style string, not a BSTR.  ACTION_READ_LINK
  648. returns the path name in ARG3.  The length of the target string is
  649. returned in RES1 (or a -1 indicating an error).
  650.  
  651. ACTION_CHANGE_MODE       1028    ChangeMode(type,obj,mode)
  652. ARG1:   LONG    Type of object to change - either CHANGE_FH or CHANGE_LOCK
  653. ARG2:   BPTR    object to be changed
  654. ARG3:   LONG    New mode for object - see ACTION_FINDINPUT, and
  655.                   ACTION_LOCATE_OBJECT 
  656.  
  657. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  658. RES2:   CODE    Failure code if RES1 is DOSFALSE
  659.  
  660. This action requests that the handler change the mode of the given
  661. file handle or lock to the mode in ARG3.  This request should fail if
  662. the handler can't change the mode as requested (for example an
  663. exclusive request for an object that has multiple users).
  664.  
  665.  
  666. ACTION_COPY_DIR_FH       1030    DupLockFromFH(fh)
  667. ARG1:   BPTR    file handle
  668.  
  669. RES1:   BPTR    Lock associated with file handle or NULL
  670. RES2:   CODE    Failure code if RES1 = NULL
  671.  
  672. This action requests that the handler return a lock associated with
  673. the currently opened file handle.  The request may fail for any
  674. restriction imposed by the file system (for example when the file
  675. handle is not opened in a shared mode).  The file handle is still
  676. usable after this call, unlike the lock in ACTION_FH_FROM_LOCK.
  677.  
  678.  
  679. ACTION_PARENT_FH         1031    ParentOfFH(fh)
  680. ARG1:   BPTR    File handle to get parent of
  681.  
  682. RES1:   BPTR    Lock on parent of a file handle
  683. RES2:   CODE    Failure code if RES1 = NULL
  684.  
  685. This action obtains a lock on the parent directory (or root of the
  686. volume if at the top level) for a currently opened file handle.  The
  687. lock is returned as a shared lock and must be freed.  Note that unlike
  688. ACTION_COPY_DIR_FH, the mode of the file handle is unimportant.  For
  689. an open file, ACTION_PARENT_FH should return a lock under all
  690. circumstances.
  691.  
  692.  
  693. ACTION_EXAMINE_ALL       1033    ExAll(lock,buff,size,type,ctl)
  694. ARG1:   BPTR    Lock on directory to examine
  695. ARG2:   APTR    Buffer to store results
  696. ARG3:   LONG    Length (in bytes) of buffer (ARG2)
  697. ARG4:   LONG    Type of request - one of the following:
  698.            ED_NAME Return only file names
  699.            ED_TYPE Return above plus file type
  700.            ED_SIZE Return above plus file size
  701.            ED_PROTECTION Return above plus file protection
  702.            ED_DATE Return above plus 3 longwords of date
  703.            ED_COMMENT Return above plus comment or NULL
  704. ARG5:   BPTR    Control structure to store state information.  The
  705.           control structure must be allocated with AllocDosObject()! 
  706.  
  707. RES1:   LONG    Continuation flag - DOSFALSE indicates termination
  708. RES2:   CODE    Failure code if RES1 is DOSFALSE
  709.  
  710.  
  711. This action allows an application to obtain information on multiple
  712. directory entries.  It is particularly useful for applications that
  713. need to obtain information on a large number of files and directories.
  714.  
  715.  
  716. This action fills the buffer (ARG2) with partial or whole ExAllData
  717. structures.  The size of the ExAllData structure depends on the type
  718. of request.  If the request type field (ARG4) is set to ED_NAME, only
  719. the ed_Name field is filled in.  Instead of copying the unused fields
  720. of the ExAllData structure into the buffer, ACTION_EXAMINE_ALL
  721. truncates the unused fields.  This effect is cumulative, so requests
  722. to fill in other fields in the ExAllData structure causes all fields
  723. that appear in the structure before the requested field will be filled
  724. in as well.  Like the ED_NAME case mentioned above, any field that
  725. appears after the requested field will be truncated (see the ExAllData
  726. structure below).  For example, if the request field is set to
  727. ED_COMMENT, ACTION_EXAMINE_ALL fills in all the fields of the
  728. ExAllData structure, because the ed_Comment field is last.  This is
  729. the only case where the packet returns entire ExAllData structures.
  730.  
  731. struct ExAllData {
  732.         struct ExAllData *ed_Next;
  733.         UBYTE  *ed_Name;
  734.         LONG    ed_Type;
  735.         ULONG   ed_Size;
  736.         ULONG   ed_Prot;
  737.         ULONG   ed_Days;
  738.         ULONG   ed_Mins;
  739.         ULONG   ed_Ticks;
  740.         UBYTE  *ed_Comment;     /* strings will be after last used field */
  741. };
  742.  
  743. Each ExAllData structure entry has an ead_Next field which points to
  744. the next ExAllData structure.  Using these links, a program can easily
  745. chain through the ExAllData structures without having to worry about
  746. how large the structure is.  Do not examine the fields beyond those
  747. requested as they certainly will not be initialized (and will probably
  748. overlay the next entry).
  749.  
  750. The most important part of this action is the ExAllControl structure.
  751. It must be allocated and freed through
  752. AllocDosObject()/FreeDosObject().  This allows the structure to grow
  753. if necessary with future revisions of the operating and file systems.
  754. Currently, ExAllControl contains four fields:
  755.  
  756. Entries - This field is maintained by the file system and indicates
  757. the actual number of entries present in the buffer after the action is
  758. complete.  Note that a value of zero is possible here as no entries
  759. may match the match string.
  760.  
  761. LastKey - This field must be initialized to 0 by the calling
  762. application before using this packet for the first time.  This field
  763. is maintained by the file system as a state indicator of the current
  764. place in the list of entries to be examined.  The file system may test
  765. this field to determine if this is the first or a subsequent call to
  766. this action.
  767.  
  768. MatchString - This field points to a pattern matching string to
  769. control which directory entries are returned.  If this field is NULL,
  770. then all entries are returned.  Otherwise, this string is used to
  771. pattern match the names of all directory entries before putting them
  772. into the buffer.  The default AmigaDOS pattern match routine is used
  773. unless MatchFunc is not NULL (see below).  Note that it is not
  774. acceptable for the application to change this field between subsequent
  775. calls to this action for the same directory.
  776.  
  777. MatchFunc - This field contains a pointer to an alternate pattern
  778. matching routine to validate entries.  If it is NULL then the standard
  779. AmigaDOS wild card routines will be used.  Otherwise, MatchFunc points
  780. to a hook function that is called in the following manner:
  781.  
  782. BOOL = MatchFunc(hookptr, data,typeptr)
  783.                    A0      A1    A2
  784. hookptr    Pointer to hook being called
  785. data       Pointer to (partially) filled in ExAll data for item being checked.
  786. typeptr    Pointer to longword indicating the type of the ExAll request (ARG4).
  787.  
  788. This function is expected to return DOSTRUE if the entry is accepted
  789. and DOSFALSE if it is to be discarded. 
  790.  
  791.  
  792. ACTION_EXAMINE_FH        1034    ExamineFH(fh,fib)
  793. ARG1:   BPTR    File handle on open file
  794. ARG2:   BPTR    FileInfoBlock to fill in
  795.  
  796. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  797. RES2:   CODE    Failure code if RES1 is DOSFALSE
  798.  
  799.  This function examines a file handle and fills in the FileInfoBlock
  800. (found in ARG2) with information about the current state of the file.
  801. This routine is analogous to the ACTION_EXAMINE_OBJECT action for
  802. locks.  Because it is not always possible to provide an accurate file
  803. size (for example when buffers have not been flushed or two processes
  804. are writing to a file), the fib_Size field (see dos/dos.h) may be
  805. inaccurate.
  806.  
  807.  
  808. ACTION_ADD_NOTIFY        4097    StartNotify(NotifyRequest)
  809. ARG1:   BPTR    NotifyRequest structure
  810.  
  811. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  812. RES2:   CODE    Failure code if RES1 is DOSFALSE
  813.  
  814. This action asks a file system to notify the calling program if a
  815. particular file is altered.  A file system notifies a program either
  816. by sending a message or by signaling a task.
  817.  
  818. struct NotifyRequest {
  819.         UBYTE *nr_Name;
  820.         UBYTE *nr_FullName;             /* set by dos - don't touch */
  821.         ULONG nr_UserData;              /* for applications use */
  822.         ULONG nr_Flags;
  823.  
  824.         union {
  825.  
  826.             struct {
  827.                 struct MsgPort *nr_Port;        /* for SEND_MESSAGE */
  828.             } nr_Msg;
  829.  
  830.             struct {
  831.                 struct Task *nr_Task;           /* for SEND_SIGNAL */
  832.                 UBYTE nr_SignalNum;             /* for SEND_SIGNAL */
  833.                 UBYTE nr_pad[3];
  834.             } nr_Signal;
  835.         } nr_stuff;
  836.  
  837.         ULONG nr_Reserved[4];           /* leave 0 for now */
  838.  
  839.         /* internal use by handlers */
  840.         ULONG nr_MsgCount;              /* # of outstanding msgs */
  841.         struct MsgPort *nr_Handler;     /* handler sent to (for EndNotify) */
  842. };
  843.  
  844. To use this packet, an application needs to allocate and initialize a
  845. NotifyRequest structure (see above).  As of this writing,
  846. NotifyRequest structures are not allocated by AllocDosObject(), but
  847. this may change in the future.  The handler gets the watched file's
  848. name from the nr_FullName field.  The current file system does not
  849. currently support wild cards in this field, although there is nothing
  850. to prevent other handlers from doing so.
  851.  
  852. The string in nr_FullName must be an absolute path, including the name
  853. of the root volume (no assigns).  The absolute path is necessary
  854. because the file or its parent directories do not have to exist when
  855. the notification is set up.  This allows notification on files in
  856. directories that do not yet exist.  Notification will not occur until
  857. the directories and file are created.
  858.  
  859. An application that uses the StartNotify() DOS call does not fill in
  860. the NotifyRequest's nr_FullName field, but instead fills in the
  861. nr_Name field.  StartNotify() takes the name from the nr_Name field
  862. and uses GetDeviceProc() and NameFromLock() to expand any assigns
  863. (such as ENV:), storing the result in nr_FullName.  Any application
  864. utilizing the packet level interface instead of StartNotify() must
  865. expand their own assigns.  Handlers must not count on nr_Name being
  866. correct.
  867.  
  868. The notification type depends on which bit is set in the
  869. NotifyRequest.nr_Flags field.  If the NRF_SEND_MESSAGE bit is set, an
  870. application receives notification of changes to the file through a
  871. message (see NotifyMessage from dos/notify.h).  In this case, the
  872. nr_Port field must point to the message port that will receive the
  873. notifying message .  If the nr_Flags NRF_SEND_SIGNAL bit is set, the
  874. file system will signal a task instead of sending a message.  In this
  875. case, nr_Task points to the task and nr_SignalNum is the signal
  876. number.  Only one of these two bits should be set!
  877.  
  878. If a program sets the NRF_WAIT_REPLY bit, the handler must wait to
  879. send pending notifications until previous ones are returned.  When a
  880. handler receives a notification request with the NRF_NOTIFY_INITIAL
  881. bit set, the handler sends an initial message or gives an initial
  882. signal if the watched file already exists.
  883.  
  884. Handlers should only perform a notification when the actual contents
  885. of the file have been changed.  This includes ACTION_WRITE,
  886. ACTION_TRUNCATE, ACTION_SET_DATE, ACTION_DELETE, ACTION_RENAME,
  887. ACTION_FINDUPDATE, ACTION_FINDINPUT, and ACTION_FINDOUTPUT.  It may
  888. also include other actions such as ACTION_SET_COMMENT or
  889. ACTION_SET_PROTECT, but this is not required (and may not be expected
  890. by the application as there is no need to reread the data).
  891.  
  892.  
  893. ACTION_REMOVE_NOTIFY     4098    EndNotify(NotifyRequest)
  894. ARG1:   BPTR    Pointer to previously added notify request
  895.  
  896. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  897. RES2:   CODE    Failure code if RES1 is DOSFALSE
  898.  
  899. This action cancels a notification (see ACTION_ADD_NOTIFY) .  ARG1 is
  900. the NotifyRequest structure used to initiate the notification.  The
  901. handler should abandon any pending notification messages.  Note that
  902. it is possible for a file system to receive a reply from a previously
  903. sent notification message even after the notification has been
  904. terminated.  It should accept these messages silently and throw them
  905. away.
  906.  
  907.  
  908.  
  909. Volume Manipulation/Information
  910.  
  911.  
  912. The Volume Manipulation and Information actions are used to allow
  913. access to the underlying volume currently being manipulated by the
  914. file system.  
  915.  
  916.  
  917. ACTION_CURRENT_VOLUME    7       <sendpkt only>
  918. RES1:   BPTR    Pointer to volume node of current volume
  919.  
  920. This action returns a pointer to the volume node (from the DOS device
  921. list) associated with the file system.  As the volume node may be
  922. removed from the device list when the file system mounts a different
  923. volume (such as when directed to by an ACTION_INHIBIT) there is no
  924. guarantee that this pointer will remain valid for any amount of time.
  925. This action is generally used by AmigaDOS to provide the volume line
  926. of a requester.
  927.  
  928.  
  929. ACTION_DISK_INFO         25      Info(...)
  930. ARG1:   BPTR    Pointer to an InfoData structure to fill in
  931.  
  932. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  933.  
  934.  
  935. ACTION_INFO              26      <sendpkt only>
  936. ARG1:   LOCK    Lock
  937. ARG2:   BPTR    Pointer to a InfoData Structure to fill in
  938.  
  939. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  940.  
  941. These actions are used to get information about the device and status
  942. of the file handler.  ACTION_DISK_INFO is used by the info command to
  943. report the status of the volume currently in the drive.  It fills in
  944. an InfoData structure about the volume the file system currently
  945. controls.  ACTION_INFO fills in an InfoData structure for the volume
  946. the lock (ARG1) is on instead of the volume currently in the drive.
  947. These actions are generally expected to return DOSTRUE.
  948.  
  949. The ACTION_DISK_INFO packet has a special meaning for console style
  950. handlers.  When presented with this packet, a console style handler
  951. should return a pointer to the window associated with the open handle.
  952.  
  953.  
  954. ACTION_RENAME_DISK      9       Relabel(...) in 2.0
  955. ARG1:   BSTR    New disk name
  956.  
  957. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  958.  
  959. This action allows an application to change the name of the current
  960. volume.  A file system implementing this function must also change the
  961. name stored in the volume node of the DOS device list.
  962.  
  963.  
  964.  
  965.  
  966. ACTION_FORMAT            1020    Format(fs,vol,type)
  967. ARG1:   BSTR    Name of device (with trailing ':')
  968. ARG2:   BSTR    Name for volume (if supported)
  969. ARG3:   LONG    Type of format (file system specific)
  970.  
  971. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  972. RES2:   CODE    Failure code if RES1 is DOSFALSE
  973.  
  974. This packet tells a file system to perform any device or file system
  975. specific formatting on any newly initialized media.  Upon receiving
  976. this action, a file system can assume that the media has already been
  977. low level formatted and should proceed to write out any high level
  978. disk structure necessary to create an empty volume.
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018. Handler Maintenance and Control
  1019.  
  1020. A number of packets are defined to give an application some control
  1021. over a file system:
  1022.  
  1023.  
  1024. ACTION_DIE               5      <sendpkt only>
  1025. RES1:   BOOL    DOSTRUE
  1026.  
  1027. As its name implies, the ACTION_DIE packet tells a handler to quit.
  1028. All new handlers are expected to implement this packet.  Because of
  1029. outstanding locks and the fact that the handler address is returned by
  1030. the DeviceProc() routine, it is unlikely that the handler can
  1031. disappear completely, but instead will have to release as many
  1032. resources as possible and simply return an error on all packets sent
  1033. to it.
  1034.  
  1035. In the future, the system may be able to determine if there are any
  1036. outstanding DeviceProc() references to a handler, and therefore make
  1037. it is safe to shut down completely.
  1038.  
  1039.  
  1040. ACTION_FLUSH             27     <sendpkt only>
  1041. RES1:   BOOL    DOSTRUE
  1042.  
  1043. This action causes the file system to flush out all buffers to disk
  1044. before returning this packet.  If any writes are pending, they must be
  1045. processed before responding to this packet.  This packet allows an
  1046. application to make sure that the data that is supposed to be on the
  1047. disk is actually written to the disk instead of waiting in a buffer.
  1048.  
  1049.  
  1050. ACTION_MORE_CACHE        18      AddBuffers(...) in 2.0
  1051. ARG1:   LONG    Number of buffers
  1052.  
  1053. RES1:   BOOL    DOSTRUE
  1054. RES2:   LONG    New number of buffers
  1055.  
  1056. This action allows an application to change the number of internal
  1057. buffers used by the file system for caching.  Note that a positive
  1058. number increases the number of buffers while a negative number
  1059. decreases the number of buffers.  In all cases, the number of current
  1060. buffers are returned in RES2.  This allows an application to inquire
  1061. the number of buffers by sending in a value of 0 (resulting in no
  1062. change).  Note that the OFS and FFS in 1.3 do not accept a negative
  1063. number of buffers.
  1064.  
  1065.  
  1066. ACTION_INHIBIT           31     Inhibit(...) in 2.0
  1067. ARG1:   BOOL    DOSTRUE = inhibit,      DOSFALSE = uninhibit
  1068.  
  1069. RES1:   BOOL    Success/failure (DOSTRUE/DOSFALSE)
  1070.  
  1071. This action is probably one of the most dangerous that a file system
  1072. has to handle.  When inhibited (ARG1 = DOSTRUE), the file system must
  1073. not access any underlying media and return an error code on all
  1074. attempts to access the device.  Once uninhibited (ARG1 = DOSFALSE),
  1075. the file system must assume that the medium has been changed.  The
  1076. file system must flush the buffers before the ACTION_INHIBIT , popping
  1077. up a requester demanding that the user put back the current disk, if
  1078. necessary.  The handler may choose to reject an inhibit request if any
  1079. objects are open for writing.
  1080.  
  1081. Although it's not required, a handler should nest inhibits.  Prior to
  1082. 2.0, the system handlers did not keep a nesting count and were subject
  1083. to some obscure race conditions.  The 2.0 ROM filing system introduced
  1084. a nesting count.
  1085.  
  1086.  
  1087. ACTION_WRITE_PROTECT     1023    <sendpkt only>
  1088. ARG1:   BOOL    DOSTRUE/DOSFALSE (write protect/un-write protect)
  1089. ARG2:   LONG    32 Bit pass key
  1090.  
  1091. RES1:   BOOL    DOSTRUE/DOSFALSE
  1092.  
  1093. This is a new packet defined for the Fast File System.  This packet
  1094. allows an application to change the write protect flag of a disk (if
  1095. possible - applications cannot write to floppies that have their
  1096. write-protect tabs set).  This packet is primarily intended to allow
  1097. write-protecting non-removable media such as hard disks.  The value in
  1098. ARG1 toggles the write status.  The 32-bit passkey allows a program to
  1099. prevent other programs from unwrite-protecting a disk.  To unlock a
  1100. disk, ARG2 must match the passkey of the packet that locked the disk,
  1101. unless the disk was locked with a passkey of 0.  In this case, no
  1102. passkey is necessary to unlock the disk.
  1103.  
  1104.  
  1105. ACTION_IS_FILESYSTEM     1027    IsFileSystem(devname)
  1106.  
  1107. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  1108. RES2:   CODE    Failure code if RES1 is DOSFALSE
  1109.  
  1110. Through this function, a handler can indicates whether or not it is a
  1111. file system (whether or not it can support separate files for storing
  1112. information).  Programs will assume a handler can create multiple,
  1113. distinct files through calls to Open() if the handler returns this
  1114. packet with a DOSTRUE value.  A handler does not need to support
  1115. directories and subdirectories in order to qualify as a file system.
  1116. It does have to support the Examine()/ExNext() calls.
  1117.  
  1118. Note that the AmigaDOS routine IsFileSystem() will attempt to use
  1119. Lock(":",SHARED_ACCESS) if this packet returns ERROR_ACTION_NOT_KNOWN.
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145. Handler Internal
  1146.  
  1147.  
  1148. There are several actions that are generally used by handlers to allow
  1149. messages returning from requested services (typically an Exec device)
  1150. to look like incoming request packets.  This allows the handler to
  1151. request an asynchronous operation but be notified of the completion.
  1152. For example, a handler sends the serial.device a request for a read,
  1153. but instead of sending a plain IO request, it sends a DOS packet
  1154. disguised as an IO request.  The serial.device treats the packet like
  1155. a normal IO request, returning it to the handler when it is finished.
  1156. When the handler gets back its disguised DOS packet, it knows that the
  1157. read has completed.
  1158.  
  1159.  
  1160. ACTION_NIL               0       <internal>
  1161.  
  1162. Although not specifically an action, many returns look like this value
  1163. because the action field has not been filled in.
  1164.  
  1165.  
  1166.  
  1167. ACTION_READ_RETURN       1001    <internal>
  1168.  
  1169. Generally used to indicate the completion of an asynchronous read
  1170. request. 
  1171.  
  1172.  
  1173.  
  1174. ACTION_WRITE_RETURN      1002    <internal>
  1175.  
  1176. Generally used to indicate the completion of an asynchronous write
  1177. request. 
  1178.  
  1179.  
  1180.  
  1181. ACTION_TIMER             30     <internal>
  1182.  
  1183. Used to indicate the passage of a time interval.  Many handlers have a
  1184. steady stream of ACTION_TIMER packets so that they can schedule house
  1185. keeping and flush buffers when no activity has occurred for a given
  1186. time interval.
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201. Obsolete Packets
  1202.  
  1203. There are several packet types that are documented within the system
  1204. include files that are obsolete.  A file system is not expected to
  1205. handle these packets and any program which sends these packets can not
  1206. expect them to work:
  1207.  
  1208. ACTION_DISK_CHANGE      33      <Obsolete>
  1209.  
  1210.  
  1211. ACTION_DISK_TYPE        32      <Obsolete>
  1212.  
  1213.  
  1214. ACTION_EVENT             6      <Obsolete>
  1215.  
  1216.  
  1217. ACTION_GET_BLOCK         2      <Obsolete>
  1218.  
  1219.  
  1220. ACTION_SET_MAP           4      <Obsolete>
  1221.  
  1222. Of particular note here is ACTION_DISK_CHANGE.  The DiskChange command
  1223. uses the ACTION_INHIBIT packet to accomplish its task.
  1224.  
  1225.  
  1226.  
  1227.  
  1228. Console Only Packets
  1229.  
  1230. The remaining packets are only used for console handlers and do not
  1231. need to be implemented by a file system.
  1232.  
  1233. ACTION_SCREEN_MODE       994    <sendpkt only>
  1234. ARG1:   LONG    Mode (zero or one)
  1235.  
  1236. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  1237. RES2:   CODE    Failure code if RES1 is DOSFALSE
  1238.  
  1239. Switch the console to and from RAW mode.  An ARG1 of one indicates the
  1240. unprocessed, raw mode while an ARG1 of zero indicates the processed,
  1241. ``cooked'' mode.
  1242.  
  1243.  
  1244. ACTION_WAIT_CHAR         20     WaitForChar()
  1245. ARG1:   ULONG   Timeout in microseconds
  1246.  
  1247. RES1:   BOOL    Success/Failure (DOSTRUE/DOSFALSE)
  1248. RES2:   CODE    Failure code if RES1 is DOSFALSE
  1249.  
  1250. Performs a timed read of a character.  The WaitForChar() function uses
  1251. this packet.
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260. Summary of Defined Packet Numbers
  1261.  
  1262. This is a listing of all the DOS packets defined by Commodore.
  1263. Packets 0-1999 are reserved for use by Commodore.  Unless otherwise
  1264. noted, packets 2050-2999 are reserved for use by third party
  1265. developers (see chart below).  The remaining packets are reserved for
  1266. future expansion (Note: packets 2008, 2009, 4097, and 4098 are in use
  1267. by Commodore).
  1268.  
  1269.         Decimal Hex     Action #define  
  1270.  
  1271.         0       0x0000  ACTION_NIL
  1272.         1               <Reserved by Commodore>
  1273.         2       0x0002  ACTION_GET_BLOCK
  1274.         3               <Reserved by Commodore>
  1275.         4       0x0004  ACTION_SET_MAP
  1276.         5       0x0005  ACTION_DIE
  1277.         6       0x0006  ACTION_EVENT
  1278.         7       0x0007  ACTION_CURRENT_VOLUME
  1279.         8       0x0008  ACTION_LOCATE_OBJECT
  1280.         9       0x0009  ACTION_RENAME_DISK
  1281.         10-14           <Reserved by Commodore>
  1282.         15      0x000F  ACTION_FREE_LOCK
  1283.         16      0x0010  ACTION_DELETE_OBJECT
  1284.         17      0x0011  ACTION_RENAME_OBJECT
  1285.         18      0x0012  ACTION_MORE_CACHE
  1286.         19      0x0013  ACTION_COPY_DIR
  1287.         20      0x0014  ACTION_WAIT_CHAR
  1288.         21      0x0015  ACTION_SET_PROTECT
  1289.         22      0x0016  ACTION_CREATE_DIR
  1290.         23      0x0017  ACTION_EXAMINE_OBJECT
  1291.         24      0x0018  ACTION_EXAMINE_NEXT
  1292.         25      0x0019  ACTION_DISK_INFO
  1293.         26      0x001A  ACTION_INFO
  1294.         27      0x001B  ACTION_FLUSH
  1295.         28      0x001C  ACTION_SET_COMMENT
  1296.         29      0x001D  ACTION_PARENT
  1297.         30      0x001E  ACTION_TIMER
  1298.         31      0x001F  ACTION_INHIBIT
  1299.         32      0x0020  ACTION_DISK_TYPE
  1300.         33      0x0021  ACTION_DISK_CHANGE
  1301.         34      0x0022  ACTION_SET_DATE
  1302.         35-39           <Reserved by Commodore>
  1303.         40      0x0028  ACTION_SAME_LOCK
  1304.         41-81           <Reserved by Commodore>
  1305.         82      0x0052  ACTION_READ
  1306.         83-86           <Reserved by Commodore>
  1307.         87      0x0057  ACTION_WRITE
  1308.         88-993          <Reserved by Commodore>
  1309.         994     0x03E2  ACTION_SCREEN_MODE
  1310.         995-1000        <Reserved by Commodore>
  1311.         1001    0x03E9  ACTION_READ_RETURN
  1312.         1002    0x03EA  ACTION_WRITE_RETURN
  1313.         1003            <Reserved by Commodore>
  1314.         1004    0x03EC  ACTION_FINDUPDATE
  1315.         1005    0x03ED  ACTION_FINDINPUT
  1316.         1006    0x03EE  ACTION_FINDOUTPUT
  1317.         1007    0x03EF  ACTION_END
  1318.         1008    0x03F0  ACTION_SEEK
  1319.         1009-1019       <Reserved by Commodore>
  1320.         1020    0x03FC  ACTION_FORMAT
  1321.         1021    0x03FD  ACTION_MAKE_LINK
  1322.         1022    0x03FE  ACTION_SET_FILE_SIZE
  1323.         1023    0x03FF  ACTION_WRITE_PROTECT
  1324.         1024    0x0400  ACTION_READ_LINK
  1325.         1025            <Reserved by Commodore>
  1326.         1026    0x0402  ACTION_FH_FROM_LOCK
  1327.         1027    0x0403  ACTION_IS_FILESYSTEM
  1328.         1028    0x0404  ACTION_CHANGE_MODE
  1329.         1029            <Reserved by Commodore>
  1330.         1030    0x0406  ACTION_COPY_DIR_FH
  1331.         1031    0x0407  ACTION_PARENT_FH
  1332.         1032            <Reserved by Commodore>
  1333.         1033    0x0409  ACTION_EXAMINE_ALL
  1334.         1034    0x040A  ACTION_EXAMINE_FH
  1335.         1035-2007       <Reserved by Commodore>
  1336.         2008    0x07D8  ACTION_LOCK_RECORD
  1337.         2009    0x07D9  ACTION_FREE_RECORD
  1338.         2010-2049       <Reserved by Commodore>
  1339.         2050-2999       <Reserved for 3rd Party Handlers>
  1340.         4097    0x1001  ACTION_ADD_NOTIFY
  1341.         4098    0x1002  ACTION_REMOVE_NOTIFY
  1342.         4099-           <Reserved by Commodore for Future Expansion>
  1343.  
  1344.